package com.wash.shoes.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.SysPermissionService;
import com.wash.shoes.common.enums.ChannelEnum;
import com.wash.shoes.common.enums.OrderStatusEnum;
import com.wash.shoes.domain.dto.*;
import com.wash.shoes.domain.dy.request.DyServiceUpdateRequest;
import com.wash.shoes.domain.order.CancelOrderComponent;
import com.wash.shoes.domain.vo.*;
import com.wash.shoes.entity.*;
import com.wash.shoes.exception.WashException;
import com.wash.shoes.mapper.*;
import com.wash.shoes.page.PageFactory;
import com.wash.shoes.service.OrderCommentService;
import com.wash.shoes.service.OrderService;
import com.wash.shoes.util.AdminUserUtil;
import com.wash.shoes.util.HeaderUtil;
import com.wash.shoes.util.StsDateInfoUtil;
import com.wash.shoes.util.WashDateUtil;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * <p>
 * 洗护订单 服务实现类
 * </p>
 *
 * @author ljg
 * @since 2024-08-29
 */
@Log4j2
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderPo> implements OrderService {

    private static final Set<String> MANAGER_ROLES = new HashSet<>(Collections.singletonList("admin"));
    @Resource
    OrderGoodMapper orderGoodMapper;
    @Resource
    OrderTransportMapper orderTransportMapper;
    @Autowired
    OrderCommentService orderCommentService;
    @Resource
    CheckHistoryMapper checkHistoryMapper;
    @Resource
    CancelOrderComponent cancelOrderComponent;
    /**
     * 权限服务
     */
    @Autowired
    private SysPermissionService permissionService;
    @Autowired
    private UserShopMapper userShopMapper;

    @Override
    public Page<OrderDetailVo> pageList(OrderPageListDto orderPo) {
        Page<OrderDetailVo> page = PageFactory.defaultPage();
        // 用户账号绑定的类型
        Long userId = SecurityUtils.getUserId();
        // 获取用户绑定的类型,
        List<String> userBindTypeList = userShopMapper.getUserBindType(userId + "");
        String userBindType = null;
        if (!CollectionUtils.isEmpty(userBindTypeList)) {
            userBindType = userBindTypeList.get(0);
        }
        String shopIdStr = HeaderUtil.getShopIdStr();
        //如果前端传入的shopid 就按shopid去查
        if (StringUtils.isNotEmpty(orderPo.getShopId())) {
            StringBuilder sb = new StringBuilder();
            sb.append("(");
            sb.append(orderPo.getShopId());
            sb.append(")");
            shopIdStr = sb.toString();
            userBindType = null;
        }

        List<OrderDetailVo> dataList = baseMapper.pageList(page, orderPo, shopIdStr, userBindType);
        setGoodSNames(dataList);
        page.setRecords(dataList);
        return page;
    }

    @Override
    public OrderPo getByOrderNo(String orderNo) {
        return baseMapper.getByOrderNo(orderNo);
    }

    @Override
    public Page<OrderDetailVo> checkInList(/*String searchString*/CheckInQuery checkInQuery) {
        Page<OrderDetailVo> page = PageFactory.defaultPage();
        // 用户账号绑定的类型
        Long userId = SecurityUtils.getUserId();
        // 获取用户绑定的类型,
        List<String> userBindTypeList = userShopMapper.getUserBindType(userId + "");
        String userBindType = null;
        if (!CollectionUtils.isEmpty(userBindTypeList)) {
            userBindType = userBindTypeList.get(0);
        }
        List<OrderDetailVo> dataList =
                baseMapper.checkInList(page, checkInQuery.getSearchString(), HeaderUtil.getShopIdStr(), userBindType, checkInQuery.getStartTime(), checkInQuery.getEndTime());
        setGoodSNames(dataList);
        setBillCodeName(dataList);
        page.setRecords(dataList);
        return page;
    }

    @Override
    public Page<OrderDetailVo> checkOutList(CheckOutDto checkOutDto) {
        // 用户账号绑定的类型
        Long userId = SecurityUtils.getUserId();
        // 获取用户绑定的类型,
        List<String> userBindTypeList = userShopMapper.getUserBindType(userId + "");
        String userBindType = null;
        if (!CollectionUtils.isEmpty(userBindTypeList)) {
            userBindType = userBindTypeList.get(0);
        }
        Page<OrderDetailVo> page = PageFactory.defaultPage();
        List<OrderDetailVo> dataList =
                baseMapper.checkOutList(page, HeaderUtil.getShopIdStr(), checkOutDto, userBindType);
        setGoodSNames(dataList);
        page.setRecords(dataList);
        return page;
    }

    /**
     * @author lijianguo
     * @Date 21/09/2024 设置名字
     **/
    public void setGoodSNames(List<OrderDetailVo> dataList) {
        for (OrderDetailVo vo : dataList) {
            List<OrderGoodPo> orderGoodPoList = orderGoodMapper.getOrderGoods(vo.getId());
            List<String> nameList = orderGoodPoList.stream().map(OrderGoodPo::getName).collect(Collectors.toList());
            vo.setOrderGoodsNames(String.join(",", nameList));
        }
    }

    @Autowired
    DyServiceUpdateRequest dyServiceUpdateRequest;
    @Autowired
    private CheckHistoryServiceImpl checkHistoryService;

    /**
     * 入库核销,如果是抖音的订单，需要去调用抖音的核销接口并记录核销记录
     *
     * @return
     */
    public boolean orderIn(OrderPo orderPo) {
        // 抖音核销
        dyServiceUpdateRequest.updateFullFill(orderPo, 4);
        //查询是否有核销记录
        CheckHistoryPo checkHistoryPo = checkHistoryService.getOne(new LambdaQueryWrapper<CheckHistoryPo>().eq(CheckHistoryPo::getOrderId, orderPo.getId())
                .eq(CheckHistoryPo::getChannel, ChannelEnum.DY.getCode()).last("limit 1"));

        if (Objects.isNull(checkHistoryPo)) {
            checkHistoryPo = new CheckHistoryPo();
            checkHistoryPo.setChannel(ChannelEnum.DY.getCode());
            checkHistoryPo.setOrderId(orderPo.getId());
            checkHistoryPo.setOrderNo(orderPo.getOrderNo());
            checkHistoryPo.setShopId(orderPo.getShopId());
            checkHistoryPo.setShopName(orderPo.getWashShop());
            checkHistoryPo.setPhone(orderPo.getCustomPhone());
            checkHistoryPo.setConpouPrice(orderPo.getOrderPrice());
        }
        checkHistoryPo.setStatus(1);
        checkHistoryPo.setMtOrderId(orderPo.getDyBookId());
        checkHistoryPo.setMtSerialNumbers(orderPo.getDyBookId());
        //保存核销记录
        return checkHistoryService.saveOrUpdate(checkHistoryPo);
    }


    /**
     * @author lijianguo
     * @Date 21/09/2024 设置名字
     **/
    public void setBillCodeName(List<OrderDetailVo> dataList) {
        for (OrderDetailVo vo : dataList) {
            List<OrderTransportPo> transportPoList = orderTransportMapper.getByOrderId(vo.getId());
            List<String> jdList =
                    transportPoList.stream().map(OrderTransportPo::getWayBillCode).collect(Collectors.toList());
            vo.setWayBillCodeNameList(String.join(",", jdList));
        }
    }

    @Override
    public HashMap orderCount() {

        HashMap<String, Integer> orderCount = new HashMap<>();
        // 用户账号绑定的类型
        List<String> userBindTypeList = userShopMapper.getUserBindType(AdminUserUtil.getUserId());
        if (Objects.nonNull(userBindTypeList) && userBindTypeList.size() > 1) {
            throw new RuntimeException("账号绑定的类型不唯一.请检查");
        }
        String userBindType = null;
        if (CollectionUtil.isNotEmpty(userBindTypeList)) {
            userBindType = userBindTypeList.get(0);
        }
        for (OrderStatusEnum statusEnum : OrderStatusEnum.values()) {
            Integer count =
                    baseMapper.orderCount(statusEnum.getStatus(), null, null, HeaderUtil.getShopIdStr(), userBindType);
            orderCount.put(statusEnum.getCode(), count);

        }
        return orderCount;
    }

    @Override
    public Integer cancelByMtOrder(String mtOrderId) {
        return this.baseMapper.cancelByMtOrder(mtOrderId);
    }

    @Override
    public OrderPo getByMtOrderId(String mtOrderId) {
        return this.baseMapper.getByMtOrderId(mtOrderId);
    }

    /**
     * 根据jd物流单号查询订单信息
     *
     * @param waybillCode
     * @return OrderPo
     */
    @Override
    public OrderPo getByJdWayBillCode(String waybillCode) {
        return this.baseMapper.getByJdWayBillCode(waybillCode);
    }

    @Override
    public Map firstCount(String beginDate) {

        // 校验登录人角色
        SysUser user = SecurityUtils.getLoginUser().getUser();

        // 角色集合
        Set<String> roles = permissionService.getRolePermission(user);
        log.info("美团取消,角色查询 {}", String.join(",", roles));

        String shopIdStr = HeaderUtil.getShopIdStr();

        // 判断用户是不是超管登录
        boolean hasManagerRole = roles.stream().anyMatch(MANAGER_ROLES::contains);
        if (hasManagerRole) {
            shopIdStr = null;
        }
        String dataStr = WashDateUtil.c2(beginDate);

        HashMap<String, Map<String, Integer>> hashMap = new HashMap<>();
        Map<String, Object[]> categories = new HashMap<>();
        categories.put("mtCount", new Object[]{1, "2", dataStr, shopIdStr});
        categories.put("dyCount", new Object[]{1, "3", dataStr, shopIdStr});
        categories.put("xcxCount", new Object[]{1, "4", dataStr, shopIdStr});
        categories.put("inCount", new Object[]{null, "1", dataStr, shopIdStr});
        categories.put("waitCount", new Object[]{2, null, null, shopIdStr});
        categories.put("outCount", new Object[]{4, null, null, shopIdStr});
        categories.put("washCount", new Object[]{3, null, null, shopIdStr});
        // 用户账号绑定的类型
        List<String> userBindTypeList = userShopMapper.getUserBindType(AdminUserUtil.getUserId());
        if (Objects.nonNull(userBindTypeList) && userBindTypeList.size() > 1) {
            throw new RuntimeException("账号绑定的类型不唯一.请检查");
        }
        String userBindType = null;
        if (CollectionUtil.isNotEmpty(userBindTypeList)) {
            userBindType = userBindTypeList.get(0);
        }
        //如果不是管理员必须要绑定类型,

        //boolean needQuery=!hasManagerRole &&StringUtils.isNotEmpty(userBindType) || hasManagerRole;

        boolean needQuery = ((!hasManagerRole && StringUtils.isNotEmpty(userBindType)) || hasManagerRole);

        // 遍历每个分类并获取统计结果
        for (Map.Entry<String, Object[]> entry : categories.entrySet()) {
            String key = entry.getKey();
            Object[] params = entry.getValue();
            // 构造统计数据的 Map
            Map<String, Integer> sumMap = new HashMap<>();
            sumMap.put("orderSum", 0);
            sumMap.put("totalShoesSum", 0);

            if (needQuery) {
                // 调用方法获取统计结果
                StatisticsSumPo statisticsSum = baseMapper.orderAndShoesCount((Integer) params[0], (String) params[1],
                        (String) params[2], (String) params[3], userBindType);
                sumMap.put("orderSum", statisticsSum.getOrderSum());
                sumMap.put("totalShoesSum", statisticsSum.getTotalShoesSum());
            }

            hashMap.put(key, sumMap);
        }
        Map<String, Object> checkMap = new HashMap<>();
        checkMap.put("orderSum", 0);
        checkMap.put("totalShoesSum", 0);
        if (needQuery) {
            Object object = checkHistoryMapper.getCheckInfo(dataStr, shopIdStr);
            checkMap = (Map<String, Object>) object;
            checkMap.put("orderSum", checkMap.get("orderSum"));
            checkMap.put("totalShoesSum", checkMap.get("orderAmount"));
        }

        hashMap.put("checkInfo", (Map) checkMap);

        return hashMap;
    }

    @Override
    public Integer todayCheckInNum() {

        Date begin = DateUtil.beginOfDay(new Date());
        Date end = DateUtil.endOfDay(new Date());
        // 用户账号绑定的类型
        Long userId = SecurityUtils.getUserId();
        // 获取用户绑定的类型,
        List<String> userBindTypeList = userShopMapper.getUserBindType(userId + "");
        String userBindType = null;
        if (!CollectionUtils.isEmpty(userBindTypeList)) {
            userBindType = userBindTypeList.get(0);
        }
        Integer count = baseMapper.todayCheckInNum(HeaderUtil.getShopIdStr(), begin, end, userBindType);

        return count;
    }

    @Override
    public List<OrderPo> sendShoeOrder(Integer status, String time) {
        return this.baseMapper.sendShoeOrder(status, time);
    }

    /**
     * 移动端的用户的订单的查询
     *
     * @param orderPo
     * @return
     */
    @Override
    public Page<OrderDetailVo> userOrderList(MobileOrderListDto orderPo) {
        Page<OrderDetailVo> page = PageFactory.defaultPage();
        List<OrderDetailVo> dataList = baseMapper.userOrderList(page, orderPo);
        for (OrderDetailVo vo : dataList) {
            List<OrderGoodPo> orderGoodPoList = orderGoodMapper.getOrderGoods(vo.getId());
            vo.setOrderGoodPoList(orderGoodPoList);
            // 是否评论
            OrderCommentPo orderCommentPo = orderCommentService.getByOrderId(vo.getId());
            if (orderCommentPo != null) {
                vo.setComments(true);
            }
        }
        setGoodSNames(dataList);
        page.setRecords(dataList);
        return page;
    }

    /**
     * 处理以前的数据,从电话号码设置到用户的id
     *
     * @param phone
     * @param customerId
     */
    @Override
    public void updateOrderToUser(String phone, String customerId) {
        this.baseMapper.updateOrderToUser(phone, customerId);
    }

    /**
     * 通过顾客ID 估计手机号码 状态查询顾客订单
     *
     * @param customerId
     * @param customPhone
     * @return
     */
    @Override
    public List<OrderPo> queryOrderByCustomerIdAndStatus(String customerId, String customPhone) {
        return this.baseMapper.queryOrderByCustomerIdAndStatus(customerId, customPhone);
    }

    /**
     * 处理小程序的订单
     *
     * @param orderId 电话
     * @param remark  备注
     */
    @Override
    @Transactional
    public OrderPo cancel(String orderId, String remark) {

        log.info("取消订单 取消订单的参数为 {} {}", orderId, remark);
        OrderPo orderPo = getById(orderId);
        if (!(StringUtils.equals(orderPo.getComeFrom(), "4") || StringUtils.equals(orderPo.getComeFrom(), "3"))) {
            throw new WashException("请在对应的平台取消订单!!");
        }
        return cancelOrderComponent.process(orderPo, remark);
    }

    /**
     * 订单的统计
     *
     * @param mobileOrderListDto
     * @return
     */
    @Override
    public HashMap<String, Integer> userOrderNum(MobileOrderListDto mobileOrderListDto) {

        HashMap<String, Integer> hashMap = new HashMap<>();

        // 待支付 PRE_PAY
        // 已取消 CANCEL
        // 服务中 SERVICING
        // 待评价 WAIT_COMMENT
        // 已完成 COMPLETED
        hashMap.put("PRE_PAY", this.baseMapper.userXcxOrderNum("-1", mobileOrderListDto.getCustomerId()));
        hashMap.put("CANCEL", this.baseMapper.userXcxOrderNum("0", mobileOrderListDto.getCustomerId()));
        hashMap.put("SERVICING", this.baseMapper.userXcxOrderNum("10", mobileOrderListDto.getCustomerId()));
        hashMap.put("WAIT_COMMENT", this.baseMapper.userXcxOrderNum("6", mobileOrderListDto.getCustomerId()));
        hashMap.put("COMPLETED", this.baseMapper.userXcxOrderNum("7", mobileOrderListDto.getCustomerId()));
        return hashMap;
    }

    @Override
    public List<OrderPo> getNotPayOrder() {
        return this.baseMapper.getNotPayOrder();
    }

    /**
     * 查询抖音已核销 可以分账的订单
     *
     * @return
     */
    @Override
    public List<OrderPo> queryDyVerification() {
        return this.baseMapper.queryDyVerification();
    }

    @Override
    public List<OrderPo> getOrderByComeFrom(String comeFrom) {
        return this.baseMapper.getOrderByComeFrom(comeFrom);
    }

    @Override
    public OrderPo getLastByPhone(String searchInfo) {
        return this.baseMapper.getLastByPhone(searchInfo);
    }

    @Override
    public List<OrderPo> needPushOrder() {
        return this.baseMapper.needPushOrder();
    }


    @Override
    public List<OrderPo> getMtNotFullFillOrderList() {
        return this.baseMapper.getMtNotFullFillOrderList();
    }

    @Autowired
    private UserShopMapper userShopMapperStic;

    @Override
    public ShopStsXcxVo shopMoneySts(ShopStsXcxDto shopStsXcxDto) {
        List<String> userBindTypeList = userShopMapperStic.getUserBindType(String.valueOf(AdminUserUtil.getUserId()));
        String userBindType = "";
        if (CollectionUtil.isNotEmpty(userBindTypeList)) {
            userBindType = userBindTypeList.get(0);
        }
        shopStsXcxDto.setComeFrom("2");
        Double mt = this.baseMapper.orderMoneySts(shopStsXcxDto, HeaderUtil.getShopIdStr(), userBindType);
        shopStsXcxDto.setComeFrom("3");
        Double dy = this.baseMapper.orderMoneySts(shopStsXcxDto, HeaderUtil.getShopIdStr(), userBindType);
        shopStsXcxDto.setComeFrom("4");
        Double xcx = this.baseMapper.orderMoneySts(shopStsXcxDto, HeaderUtil.getShopIdStr(), userBindType);
        shopStsXcxDto.setComeFrom("1");
        Double dianPu = this.baseMapper.orderMoneySts(shopStsXcxDto, HeaderUtil.getShopIdStr(), userBindType);

        ShopStsXcxVo shopStsXcxVo = new ShopStsXcxVo();
        shopStsXcxVo.setMeiTuanTotalReceived(mt);
        shopStsXcxVo.setMeiTuanTotalActual(mt);
        shopStsXcxVo.setDyTotalReceived(dy);
        shopStsXcxVo.setDyTotalActual(dy);
        shopStsXcxVo.setXcxTotalReceived(xcx);
        shopStsXcxVo.setXcxTotalActual(xcx);
        shopStsXcxVo.setPcTotalReceived(dianPu);
        shopStsXcxVo.setPcTotalActual(dianPu);

        return shopStsXcxVo;
    }

    @Override
    public StsAllInfo orderMoneySts(ShopStsXcxDto shopStsXcxDto) {
        StsAllInfo stsAllInfo = new StsAllInfo();
        List<String> userBindTypeList = userShopMapperStic.getUserBindType(String.valueOf(AdminUserUtil.getUserId()));
        String userBindType = "";
        if (CollectionUtil.isNotEmpty(userBindTypeList)) {
            userBindType = userBindTypeList.get(0);
        }
        String shopIdStr = HeaderUtil.getShopIdStr();
        List<StsOrderVo> list1 = baseMapper.orderMoneyDaySts(shopStsXcxDto, shopIdStr, userBindType);
        List<ItemTypeStatisVo> sts1 = baseMapper.selectStatisByItemTypeWithDate(shopStsXcxDto, shopIdStr, userBindType);
        Map<String, ItemTypeStatisVo> map1 = sts1.stream().collect(Collectors.toMap(ItemTypeStatisVo::getDateStr, Function.identity()));

        list1.stream().forEach(item -> {
            ItemTypeStatisVo itemTypeStatisVo = map1.get(item.getDateStr());
            if (Objects.nonNull(itemTypeStatisVo)) {
                item.setOtherCount(itemTypeStatisVo.getOtherCount());
                item.setShoeNum(itemTypeStatisVo.getShoeCount());
                item.setYifuCount(itemTypeStatisVo.getYifuCount());
            }
        });


        // 时间的统计
        stsAllInfo.setDaySts(list1);
        // 订单的统计
        List<ItemTypeStatisVo> sts = baseMapper.selectStatisByItemType(shopStsXcxDto, shopIdStr, userBindType);
        //
        Map<String, ItemTypeStatisVo> map = sts.stream().collect(Collectors.toMap(ItemTypeStatisVo::getShopId, Function.identity()));
        // 在这里补充为0的数据哦
        stsAllInfo.setDaySts(StsDateInfoUtil.processEmptyDays(stsAllInfo.getDaySts(), shopStsXcxDto));

        List<StsOrderVo> list = this.baseMapper.orderMoneyShopSts(shopStsXcxDto, shopIdStr, userBindType);
        list.stream().forEach(item -> {
            ItemTypeStatisVo itemTypeStatisVo = map.get(item.getShopId());
            if (Objects.nonNull(itemTypeStatisVo)) {
                item.setOtherCount(itemTypeStatisVo.getOtherCount());
                item.setShoeNum(itemTypeStatisVo.getShoeCount());
                item.setYifuCount(itemTypeStatisVo.getYifuCount());
            }
        });

        // 店铺的统计
        stsAllInfo.setShopSts(list);
        // 统计总的数量
        return stsAllInfo;
    }

    @Override
    public StsAllInfo orderWashShopSts(ShopStsXcxDto shopStsXcxDto) {
        StsAllInfo stsAllInfo = new StsAllInfo();
        List<String> userBindTypeList = userShopMapperStic.getUserBindType(String.valueOf(AdminUserUtil.getUserId()));
        String userBindType = "";
        if (CollectionUtil.isNotEmpty(userBindTypeList)) {
            userBindType = userBindTypeList.get(0);
        }
        String shopIdStr = HeaderUtil.getShopIdStr();
        List<StsOrderVo> list1 = baseMapper.orderWashShopDaySts(shopStsXcxDto, shopIdStr, userBindType);

        List<ItemTypeStatisVo> sts1 = baseMapper.selectStatisByItemTypeWithDate(shopStsXcxDto, shopIdStr, userBindType);
        Map<String, ItemTypeStatisVo> map1 = sts1.stream().collect(Collectors.toMap(ItemTypeStatisVo::getDateStr, Function.identity()));

        list1.stream().forEach(item -> {
            ItemTypeStatisVo itemTypeStatisVo = map1.get(item.getDateStr());
            if (Objects.nonNull(itemTypeStatisVo)) {
                item.setOtherCount(itemTypeStatisVo.getOtherCount());
                item.setShoeNum(itemTypeStatisVo.getShoeCount());
                item.setYifuCount(itemTypeStatisVo.getYifuCount());
            }
        });

        // 时间的统计
        stsAllInfo.setDaySts(list1);
        // 在这里补充为0的数据哦
        stsAllInfo.setDaySts(StsDateInfoUtil.processEmptyDays(stsAllInfo.getDaySts(), shopStsXcxDto));

        // 订单的统计
        List<ItemTypeStatisVo> sts = baseMapper.selectStatisByItemType(shopStsXcxDto, shopIdStr, userBindType);
        //
        Map<String, ItemTypeStatisVo> map = sts.stream().collect(Collectors.toMap(ItemTypeStatisVo::getShopId, Function.identity()));

        List<StsOrderVo> list = this.baseMapper.orderWashShopSts(shopStsXcxDto, shopIdStr, userBindType);
        list.stream().forEach(item -> {
            ItemTypeStatisVo itemTypeStatisVo = map.get(item.getShopId());
            if (Objects.nonNull(itemTypeStatisVo)) {
                item.setOtherCount(itemTypeStatisVo.getOtherCount());
                item.setShoeNum(itemTypeStatisVo.getShoeCount());
                item.setYifuCount(itemTypeStatisVo.getYifuCount());
            }
        });

        // 洗鞋工厂的统计
        stsAllInfo.setShopSts(list);
        // 在这里补充为0的数据哦
//        stsAllInfo.setShopSts(StsDateInfoUtil.processEmptyDays(stsAllInfo.getShopSts(), shopStsXcxDto));
        // 统计总的数量
        return stsAllInfo;
    }

    @Override
    public StsAllInfo orderWashShoeSts(ShopStsXcxDto shopStsXcxDto) {
        StsAllInfo stsAllInfo = new StsAllInfo();
        List<String> userBindTypeList = userShopMapperStic.getUserBindType(String.valueOf(AdminUserUtil.getUserId()));
        String userBindType = "";
        if (CollectionUtil.isNotEmpty(userBindTypeList)) {
            userBindType = userBindTypeList.get(0);
        }
        // 时间的统计只是洗鞋的数量
        stsAllInfo.setDaySts(baseMapper.orderWashShoeShoeDaySts(shopStsXcxDto, HeaderUtil.getShopIdStr(), userBindType));
        // 在这里补充为0的数据哦
        stsAllInfo.setDaySts(StsDateInfoUtil.processEmptyDays(stsAllInfo.getDaySts(), shopStsXcxDto));
        // 店铺的统计只是洗鞋的数量
        stsAllInfo.setShopSts(this.baseMapper.orderWashShoeShopDaySts(shopStsXcxDto, HeaderUtil.getShopIdStr(), userBindType));
        // 统计总的数量
        return stsAllInfo;
    }

    @Override
    public Page<OrderDetailVo> recommendPageList(ShopStsXcxDto shopStsXcxDto) {
        Page<OrderDetailVo> page = PageFactory.defaultPage();
        List<OrderDetailVo> dataList = baseMapper.recommendPageList(page, shopStsXcxDto);
        setGoodSNames(dataList);
        page.setRecords(dataList);
        return page;
    }
}
